Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing filtering of task src files #1202

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jpommerening
Copy link

The documentation mentions that one can filter the source files with a custom filter function. After some failed attempts at using that feature I had a look at the source and noticed the filter feature works only in some cases (compact & files array).

I've added some tests for the filter-thing and made it work for the following file configurations:

// Compact (http://gruntjs.com/configuring-tasks#compact-format)
target1: {
  dest: 'dist/file1.js',
  src: [ 'one/**/*.js' ],
  filter: filterFn
},
// Files object (http://gruntjs.com/configuring-tasks#files-object-format)
target2: {
  files: {
    'dist/file1.js': [ 'one/**/*.js' ],
    'dist/file2.js': [ 'two/**/*.js' ]
  },
  filter: filterFn
},
// Files array (http://gruntjs.com/configuring-tasks#files-array-format)
target3: {
  files: [
    { dest: 'dist/file1.js', src: [ 'one/**/*.js' ], filter: filterFn },
    { dest: 'dist/file2.js', src: [ 'two/**/*.js' ], filter: filterFn }
  ]
},
// Files objects in array (undocumented?)
target4: {
  files: [
    { 'dist/file1.js': [ 'one/**/*.js' ] },
    { 'dist/file2.js': [ 'two/**/*.js' ] }
  ],
  filter: filterFn
},

Note that the resulting files object does not contain the filter property (but .orig does).

@vladikoff vladikoff added this to the 0.4.6 milestone Aug 24, 2014
Base automatically changed from master to main March 22, 2021 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants